/**
 * 
 */
package com.dsbridge.bank.business;

import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.dsbridge.bank.dao.TransactionDAO;
import com.dsbridge.bank.model.Transction;

/**
 * @author Naveen
 * 
 */
@Service
public class TransactionBusinessService implements TransactionBusinessServiceInterface {
	private TransactionDAO tdao;

	/* (non-Javadoc)
	 * @see com.dsbridge.bank.business.TransactionBusinessServiceInterface#insert(com.dsbridge.bank.model.Transction)
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Transction insert(Transction t) throws SQLException {

		int t1 = tdao.insert(t);
		t.setTaxid(t1);
		return t;

	}

	/* (non-Javadoc)
	 * @see com.dsbridge.bank.business.TransactionBusinessServiceInterface#update(com.dsbridge.bank.model.Transction)
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Transction update(Transction t) throws SQLException {
		int t2 = tdao.update(t);

		return t;
	}

	/* (non-Javadoc)
	 * @see com.dsbridge.bank.business.TransactionBusinessServiceInterface#delete(com.dsbridge.bank.model.Transction)
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Transction delete(Transction t) throws SQLException {
		int t3 = tdao.delete(t);
		return t;

	}

	/* (non-Javadoc)
	 * @see com.dsbridge.bank.business.TransactionBusinessServiceInterface#retrieveTransbyAccountid(int)
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public List<Transction> retrieveTransbyAccountid(int accountid)
			throws SQLException {

		List<Transction> tc = tdao.retrieveTransbyAccountid(accountid);
		return tc;

	}
}
